package com.education.platform.controller;

import com.education.platform.common.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * 测试控制器
 * 
 * @author education-platform
 * @since 2024-09-27
 */
@Tag(name = "系统测试", description = "系统健康检查和测试接口")
@RestController
@RequestMapping("/api/test")
public class TestController {

    @Operation(summary = "健康检查", description = "检查系统是否正常运行")
    @GetMapping("/health")
    public Result<Map<String, Object>> health() {
        Map<String, Object> data = new HashMap<>();
        data.put("status", "UP");
        data.put("timestamp", LocalDateTime.now());
        data.put("message", "系统运行正常");
        data.put("version", "1.0.0");
        return Result.success(data);
    }

    @Operation(summary = "API文档测试", description = "测试API文档是否正常")
    @GetMapping("/docs")
    public Result<Map<String, Object>> docs() {
        Map<String, Object> data = new HashMap<>();
        data.put("swagger-ui", "http://localhost:8080/swagger-ui.html");
        data.put("knife4j", "http://localhost:8080/doc.html");
        data.put("api-docs", "http://localhost:8080/v3/api-docs");
        data.put("message", "API文档链接");
        return Result.success(data);
    }
} 